<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
<script>


</script>

<script>
    var arr = [1, 2, 3, 4, 5]
    let test = (a, b, c, d, e) => {
        console.log(a, b, c, d, e)
    }
    // ...arr : 展开数组为可变参数
    test(...arr)
    //合并数组
    var arr1 = [1, 2, 3]
    var arr2 = [4, 5, 6]
    var arr3 = [...arr1, ...arr2]
    var arr4 = [arr1, arr2]
    console.log(arr3)
    console.log(arr4)
    //合并对象
    var obj1 = {
        name: 'zhangsan',
        age: 18
    }
    var obj2 = {
        sex: 'man',
        height: 180
    }
    var obj3 = {...obj1, ...obj2}
    console.log(obj3)
    // 对象解构
    var obj4 = {
        name: 'lisi',
        age: 18,
        sex: 'man'
    }
    let {name, age, sex} = obj4
    console.log(name)
    console.log(age)
    console.log(sex)
    // 数组解构
    var arr5 = [1, 2, 3]
    let [a, b, c] = arr5
    console.log(a)
    console.log(b)
    console.log(c)
    // 函数参数解构
    function test1({name, age}) {
        console.log(name)
        console.log(age)
    }
    test1({name: 'zhangsan', age: 18})
    // 函数参数解构
    function test2([a, b]) {
        console.log(a)
        console.log(b)
    }
    test2([1, 2])
</script>
</script>

</body>
</html>